import logging

from playwright.sync_api import sync_playwright

from framework.DeployCommandManager import DeployCommandManager
from framework.Login import Login

from framework.SuperClass import SuperClass


class Deploy:
    # 是否启动无痕模式
    headless = False
    log = None  # type: logging
    page = None  # type: Page
    deployCommandManager = None  # type: DeployCommandManager

    def __init__(self):
        self.log = logging
        # topic start : 显示浏览器和开启调试窗口
        playwright = sync_playwright().start().chromium.launch(headless=self.headless, devtools=False)
        # topic end
        context = playwright.new_context()
        # Open new page
        self.page = context.new_page()
        self.login = Login(self.page, self.log)
        self.deployCommandManager = DeployCommandManager(self.page, self.log)
